package com.axisdesign.client;

import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;

public class BottomFrame extends Composite {
	final String orderFormLink = DOCstring.getWndVariable("orderForm");
	final String placeOrderLink = DOCstring.getWndVariable("placeOrder");
	final String changeRequestLink = DOCstring.getWndVariable("changeRequest");
	
	SimplePanel masterPanel;
	HorizontalPanel mainPanel;
	AbsolutePanel centerPanel;
	
	Image background;
	Image orderForms;
	Image placeOrder;
	Image changeRequest;
	
	
	public BottomFrame() {
		masterPanel = new SimplePanel();
		mainPanel = new HorizontalPanel();
		centerPanel = new AbsolutePanel();
		
		background = new Image("images/bottomFrame/background.png");
		orderForms = new Image("images/bottomFrame/orderforms.png");
		placeOrder = new Image("images/bottomFrame/placeorder.png");
		changeRequest = new Image("images/bottomFrame/changerequest.png");
	
		
		mainPanel.setStyleName("bottomFrame");
		DOM.setElementProperty(mainPanel.getElement(), "align", "center");
		
		init();
		masterPanel.add(mainPanel);
		initWidget(masterPanel);
	}

	private void init() {		
		centerPanel.add(background);
		centerPanel.add(orderForms);
		centerPanel.add(placeOrder);
		centerPanel.add(changeRequest);
		
		centerPanel.setWidgetPosition(orderForms, 730, 5);
		centerPanel.setWidgetPosition(placeOrder, 794, 5);
		centerPanel.setWidgetPosition(changeRequest, 854, 5);
		
		mainPanel.add(centerPanel);
		
		orderForms.addClickListener(new ClickListener() {public void onClick(Widget sender) {HrefLink.gotoLink(orderFormLink);}});
		placeOrder.addClickListener(new ClickListener() {public void onClick(Widget sender) {HrefLink.gotoLink(placeOrderLink);}});
		changeRequest.addClickListener(new ClickListener() {public void onClick(Widget sender) {HrefLink.gotoLink(changeRequestLink);}});
	}
}
